<?php
	namespace app\models\test_study;
	use yii\db\ActiveRecord;
	class admin extends ActiveRecord{
		public function rules(){
			return [
				['id','integer','message'=>'字符只能为整形'],
				//
				[['username','password'],'required','message'=>'用户名不能ds为空'],
				['repassword','checkRepassword']//可以使用一个自定义的函数去判断传来字段的信息
			];
		}
		//$attribute是传来的那个内容，$params可以用以返回的信息
		public function checkRepassword($attribute,$params){
			if($this->$attribute == 'fuck'){
				$params['message'] = 'fuck you , too';
				$this->addError($attribute,$params);
				
			}
		}
	}
?>